#一些工具函数

#查找近期的
def findPeaks(df):
    prices=list(df)
    peaks=[]
    for i in range(1,len(prices)-1):
        if prices[i-1]<prices[i] and prices[i]>prices[i+1]:
            peaks.append(prices[i])
    return peaks

#查找最近底部
def findBottoms(df):
    prices=list(df)
    bottoms=[]
    for i in range(1,len(prices)-1):
        if prices[i-1]>prices[i] and prices[i]<prices[i+1]:
            bottoms.append(prices[i])
    return bottoms